Skip to content

Reductive audit: delete what the from-scratch version wouldn't have#81

Merged
arzafran merged 12 commits into
mainfrom
reductive-audit
Jul 9, 2026
Merged

Reductive audit: delete what the from-scratch version wouldn't have#81
arzafran merged 12 commits into
mainfrom
reductive-audit

Conversation

@arzafran

@arzafran arzafran commented Jul 9, 2026

Copy link
Copy Markdown
Member

What this does

Deletion-only audit of the whole repo against one question: if we were building a lean terminal 100% optimized for our workflow today, would this exist? No refactors, no renames, no behavior changes to what survives. One commit per subsystem so each is individually revertible.

Net: about -5,600 lines across 12 commits (audit phase -3,500, approved settings removals -2,100). Discovery ran as 7 parallel read-only audit agents plus an adversarial liveness cross-check on every high-confidence candidate before anything was deleted. Every commit built green locally before push.

Deleted

1. cmux leftovers (87aed0ff, -2,199)

  • skills/ (cmux, cmux-browser, cmux-markdown, cmux-debug-windows, release): every example invokes the nonexistent cmux binary, references Sources/cmuxApp.swift or -scheme cmux (neither exists), and skills/release describes the pre-auto-ship release process with a cmux-macos.dmg asset
  • Package.swift + Package.resolved: root SwiftPM manifest for a package named cmux building Sources/ as a SwiftTerm executable. Not referenced by the Xcode project, CI, or any doc; cannot compile
  • scripts/rebuild.sh (built via that dead manifest, violates the no-bare-xcodebuild policy), scripts/run-e2e.sh (hardcodes REPO=manaflow-ai/cmux, targets the wrong repository entirely), scripts/generate_dark_icon.py (requires design/cmux-icon-chevron.png; no design/ dir exists), scripts/notify_probe.sh, scripts/probe-pure-prompt-duplication.py (one-off probes for closed investigations)
  • docs/socket-focus-steal-audit.todo.md (completed todo, every item checked)
  • Phantom homebrew-cmux submodule removed from .claude/commands/pull.md and sync-branch.md; stale cmux binary name fixed in one daemon/remote/README.md example

2. Dead Swift code (653f10a9, -583)

  • Sources/TerminalView.swift: pre-Ghostty SwiftTerm prototype, zero references, and the only Sources file with no PBXBuildFile entry (it wasn't even compiled)
  • Sources/WindowToolbarController.swift: never instantiated, start(tabManager:) has no call site
  • GhosttyTerminalView.swift: pre-rename GHOSTTYTABS_DEBUG_BG / GhosttyTabsDebugBG debug-flag fallbacks with zero writers anywhere

3. Dead availability fallbacks (dc961ae1, -31)
Deployment target is 14.0 everywhere, so #available guards for macOS 11.0/13.0/13.3/14.0 were tautologies with unreachable else branches (Backport.swift, ContentView.swift, BrowserPopupWindowController.swift, BrowserPanel.swift x2, ProgramaWebView.swift). Left alone: macOS 15/26 guards and the compound preferAsync check in TerminalController+BrowserAutomation.swift, whose fallback is reachable.

4. Orphaned resources (c0973073, -624)

  • 51 of 944 Localizable.xcstrings keys with zero String(localized:) references: cmux-branded leftovers (dialog.quitCmux.*, menu.quitCmux, browser.proceedInCmux) and keys superseded by renamed successors. Each key independently re-verified; one false positive (cli.claude-teams.usage) caught and kept
  • AppIcon.icon/: inert navigator-only file reference, never compiled (icons come from Assets.xcassets appiconsets)
  • Info.plist CFBundleURLTypes registering Programa as a Default-rank http/https handler: the only URL entry point filters to isFileURL, so picking Programa as default browser would silently swallow every link. Registration shipped with no handler since the cmux-era commit that added it

5. Vestigial settings enums (2d3d048a, -65)
WorkspaceTitlebarSettings + WorkspaceButtonFadeSettings: replaced by Minimal Mode; their init/read entry points had no call sites and no UI surfaces them.

Audited, nothing to delete: the Debug menu (all 8 debug windows + every menu item trace to live features), tests/ vs tests_v2/ (both live, distinct purposes), Sparkle auto-update (fully live: keep Sources/Update/, sparkle scripts, appcast generation).

Options removed (approved 2026-07-09)

The maintainer reviewed the options table and approved removing everything except the search engine picker and the sidebar tint cluster. Five more commits, one per group, each verified with the app build plus build-for-testing (compiles unit and UI test targets):

6. App Icon picker (40d6d14e, -325) — icon always tracks system appearance. A one-time launch cleanup clears any stale manual override so the dock-tile plugin follows too.

7. Language picker (ea41005a, -229) — app always follows the system language. Not purely subtractive: the picker wrote the native AppleLanguages override, which would have persisted forever with no UI left to undo it, so a one-time version-gated migration clears it. Localization infra and all translations stay.

8. Notification emphasis + Send Test (fb496363, -249) — Dock Badge, Unread Pane Ring, and Pane Flash are hardcoded on; the Send Test button goes; the permission row and Enable button stay.

9. React Grab version + import hint style (4f4dc8ad, -424) — version pinned to 0.1.29, closing the real bug where unknown versions silently skipped the integrity check. The blank-tab import hint always renders as the toolbar chip; the variant enum, its debug preview window, and the dead render paths collapse away; the show/hide toggle stays. The five browser-import UI tests now exercise the real chip-then-popover flow instead of forcing a removed variant via env hook.

10. Sidebar detail cluster (bf814304, -922) — the biggest sprawl: master toggle + 11 dependents all collapse to defaults (everything visible, vertical branch layout, links open in the Programa browser). The collapse point is the precomputed SidebarTabItemSettingsSnapshot, so zero lines change inside the typing-latency-protected TabItemView. Socket-driven features (report_meta pills, git polling, port scanning) untouched.

Kept as instructed: Default Search Engine picker, sidebar tint/appearance cluster. Also kept (were already KEEP recommendations): appearance mode, workspace placement, minimal mode, Cmd+W semantics, preferred editor, notification sound + command, socket control mode + password, Claude Code integration, port base/range, trusted directories, browser link routing, HTTP allowlist, all rebindable shortcuts, reset button.

Deferred

Left in place, with the reason:

  • ghostty.h root bridge header: deleted in c0973073, restored in 30aae424. Nothing includes it, but scripts/ensure-ghosttykit.sh validates it as a contract and fails the GhosttyKit source-build fallback without it (this is what turned compat-tests and ui-regressions red mid-audit when the prebuilt xcframework download 404'd). Removing it for real means also removing that guard: maintainer call

  • cmux -> programa migration shims (settings-file fallback to ~/.config/cmux, migrateCmuxDefaultsToProgramaIfNeeded, socket-password Keychain migration, browser-theme legacy bool, SocketControlSettings.parseMode legacy mode strings, WorkspaceTabColorSettings legacy palette keys): live for anyone who installed before the rename. Delete as a batch once you decide the installed base has migrated

  • Live cmux-named internals (CLI struct CMUXCLI, 361 cmux_* identifiers in shell-integration scripts, Resources/bin/claude + open wrappers, settings.schema.json title, programa.sdef Cmux event codes, cmuxPortBase/cmuxPortRange UserDefaults keys, ATS cmux-loopback.localtest.me host): all functioning; renaming is tracked by plans/rebrand-cmux-to-programa.md and is out of scope for deletion-only work

  • plans/ (rebrand plan, board-sweep plan): still tracking real remaining work

  • Backport.onKeyPress wrapper: now a pass-through; inlining at call sites is a refactor

  • runSplitCloseRightVisualRepro shotsDir param (TabManager.swift): env var has zero writers, but removal is a signature change

  • scripts/test-unit.sh, scripts/sparkle_generate_keys.sh, scripts/launch-tagged-automation.sh, .github/workflows/test-depot.yml: unreferenced or overlapping but plausibly still wanted as manual tools

Broken things found (need fixes, not deletions)

  • scripts/reloadp.sh still searches DerivedData for cmux.app; the Release product is Programa.app, so it always exits 1. The documented reloadp workflow is broken today
  • .github/ISSUE_TEMPLATE/bug_report.yml is fully cmux-branded (tells users to run cmux --version); config.yml points discussions at manaflow-ai/cmux
  • ReactGrab integrity check silently skips unknown versions (see table above)
  • "Open All Debug Windows" opens 6 of the 8 debug windows

CI status

Audit-phase CI went red twice and both were fixed forward: the ghostty.h deletion tripped the ensure-ghosttykit source-build guard (restored, 30aae424), and the removed settings enums had unit tests the local app-scheme build does not compile (tests deleted, 48506c74, and every later commit is verified with build-for-testing). All checks are green on the final head (compat-tests macos-15/26, tests, tests-build-and-lag, ui-regressions, remote-daemon-tests, workflow-guard-tests, build-ghosttykit).

Test Plan

  • Local Debug build green after every commit
  • CI green on this PR

arzafran added 12 commits July 9, 2026 11:14
…scripts, phantom submodule refs

- skills/ (cmux, cmux-browser, cmux-markdown, cmux-debug-windows, release):
  every example invokes the nonexistent `cmux` binary, references
  Sources/cmuxApp.swift or -scheme cmux (neither exists), and skills/release
  describes the pre-auto-ship release process with a cmux-macos.dmg asset
- Package.swift + Package.resolved: root SwiftPM manifest for a package named
  cmux building Sources/ as a SwiftTerm executable — not referenced by the
  Xcode project, CI, or any doc; cannot compile
- scripts/rebuild.sh: built via that dead Package.swift, violates the no-bare-
  xcodebuild/no-untagged-launch policy; removed its CONTRIBUTING.md row
- scripts/run-e2e.sh: hardcodes REPO=manaflow-ai/cmux (old upstream) — targets
  the wrong repository entirely; CLAUDE.md documents the direct gh invocation
- scripts/generate_dark_icon.py: requires design/cmux-icon-chevron.png; no
  design/ directory exists anywhere in the repo
- scripts/notify_probe.sh, scripts/probe-pure-prompt-duplication.py: one-off
  cmux-era debug probes for closed investigations
- docs/socket-focus-steal-audit.todo.md: completed todo (every item checked)
- .claude/commands/pull.md, sync-branch.md: drop phantom homebrew-cmux
  submodule (only ghostty and vendor/bonsplit exist in .gitmodules)
- daemon/remote/README.md: fix stale cmux binary name in one example
…controller, pre-rename debug flags

- Sources/TerminalView.swift (96 lines): pre-Ghostty SwiftTerm prototype
  (TerminalContainerView/FocusableTerminalView/SwiftTermView). Not referenced
  anywhere and not even compiled — the only Sources file with no PBXBuildFile
  entry. Superseded by GhosttyTerminalView.
- Sources/WindowToolbarController.swift (89 lines): NSToolbarDelegate class
  never instantiated anywhere; its start(tabManager:) has no call site.
  Removed with its four pbxproj entries.
- GhosttyTerminalView.swift backgroundLogEnabled: drop GHOSTTYTABS_DEBUG_BG /
  GhosttyTabsDebugBG fallbacks — pre-rename flag names with zero writers in
  the repo, superseded by PROGRAMA_DEBUG_BG / PROGRAMA_DEBUG_LOG /
  programaDebugBG (which reload.sh and tests_v2 actively use)
…arget

MACOSX_DEPLOYMENT_TARGET is 14.0 for every target and configuration, so
guards for macOS 11.0/13.0/13.3/14.0 are tautologies and their else branches
are unreachable:

- Backport.swift: onKeyPress #available(macOS 14) wrapper and its no-op
  macOS 13 fallback
- ContentView.swift: ClearScrollBackground #available(macOS 13.0) fork
- BrowserPopupWindowController.swift + BrowserPanel.swift: two
  #available(macOS 13.3) guards around webView.isInspectable
- BrowserPanel.swift: guard #available(macOS 14.0) in
  applyRemoteProxyConfigurationIfAvailable
- ProgramaWebView.swift: #available(macOS 11.0) around UTType(mimeType:)

Left alone: #available(macOS 15/26) guards (above target, live) and the
compound 'if preferAsync, #available(macOS 11.0, *)' in
TerminalController+BrowserAutomation.swift whose else branch is reachable
via preferAsync == false
…undle, vestigial bridge header, handler-less URL scheme registration

- Localizable.xcstrings: remove 51 of 944 keys with zero String(localized:)
  references anywhere in the repo. Mix of cmux-branded leftovers
  (dialog.quitCmux.*, menu.quitCmux, browser.proceedInCmux,
  menu.app.openCmuxSettingsFile) and keys superseded by renamed successors
  (alert.moveTab.* replaced dialog.moveTab.*, resetPalette.subtitleV2
  replaced .subtitle, sidebar.remote.subtitleFallback replaced .subtitle,
  etc.). Independently re-verified each key before removal;
  cli.claude-teams.usage was a false positive and stays.
- AppIcon.icon/: Icon Composer bundle present only as an inert Xcode
  navigator file reference — no PBXBuildFile, no Resources build phase entry;
  ASSETCATALOG_COMPILER_APPICON_NAME points at Assets.xcassets appiconsets
- ghostty.h: 4-line wrapper from the pre-GhosttyKit bridging approach; the
  live bridge is programa-Bridging-Header.h (@import GhosttyKit) and nothing
  includes this file
- Info.plist: drop CFBundleURLTypes registering Programa as a Default-rank
  http/https handler — the only URL entry point filters to isFileURL and
  silently drops web URLs, so selecting Programa as default browser would
  swallow links; registration has had no handler since the cmux-era commit
  that added it
WorkspaceTitlebarSettings and WorkspaceButtonFadeSettings predate
WorkspacePresentationModeSettings (Minimal Mode), which replaced them.
WorkspaceButtonFadeSettings.initializeStoredModeIfNeeded() and isEnabled()
have no call sites; WorkspaceTitlebarSettings.isVisible() was only called
from that uncalled migration path. No UI surfaces either enum. Their
orphaned localization keys (settings.app.fadeButtons.*,
settings.app.showWorkspaceTitlebar.*) went in the previous commit; the
resetAllSettings() lines that scrubbed their legacy UserDefaults keys go
here.
scripts/ensure-ghosttykit.sh validates that the root ghostty.h re-exports
ghostty/include/ghostty.h and fails the GhosttyKit source-build fallback
without it (compat-tests and ui-regressions both went red when the prebuilt
xcframework download 404'd and the fallback ran). No Swift/C file includes
it, but the build system treats it as a contract. Reclassified as Deferred:
removing it means also removing the guard, which is a maintainer call.
Follow-up to 2d3d048, which removed the vestigial pre-Minimal-Mode settings
enums but missed their unit tests (the programa scheme doesn't compile
programaTests, so the local build stayed green while compat-tests went red).

- Delete the four tests that exercised the removed
  WorkspaceButtonFadeSettings.initializeStoredModeIfNeeded migration
- Strip legacy-key save/restore hygiene from the three surviving
  Minimal Mode tests; their assertions are unchanged

Verified with build-for-testing on the programa-unit scheme.
…appearance

Approved removal. AppIconMode/AppIconSettings enums, the AppIconPickerRow,
the settings.json app.appIcon key (parse + template + schema), five
localization keys, and the AppIconSettingsTests class go; the automatic
behavior (AppIconAppearanceObserver) stays and is now the only path.
ensureApplicationIcon() clears any stale appIconMode override once at launch
so the cross-process dock-tile plugin falls back to automatic too.
…language

Approved removal. The 19-way AppLanguage picker, restart dialog,
relaunchApp(), the settings.json app.language plumbing (parse/apply/restore/
template/schema), and six localization keys go. Localization infrastructure
and all translations stay untouched.

Not purely subtractive: LanguageSettings wrote the native AppleLanguages
UserDefaults override, which persists across launches with no UI left to
undo it. A one-time version-gated migration (matching the existing
migrateCmuxDefaultsToProgramaIfNeeded idiom) clears AppleLanguages and the
stale appLanguage key so previously overridden installs return to the
system language.
…button — always on

Approved removal. Dock Badge, Unread Pane Ring, and Pane Flash toggles go
from Settings, settings.json (parse/template/schema), and their backing
enums; the behaviors are hardcoded on (today's defaults). The Send Test
button and sendSettingsTestNotification() go; the Desktop Notifications
permission row and Enable button stay. Two tests of the removed preference
plumbing and six orphaned localization keys go with them.
Approved removals.

React Grab: the free-text version field goes from Settings, settings.json,
and the schema; the version is pinned to 0.1.29. This also closes a real
gap: a version not in knownHashes silently skipped the SHA-256 integrity
check, contradicting the settings copy — with the pin, the check always
runs against a known hash.

Import hint: the blank-tab hint always renders as the toolbar chip (the
production default). The variant enum, its debug-only picker window, the
inlineStrip/floatingCard render paths, and the settingsOnly state collapse
away; the user-facing show/hide toggle stays. The five browser-import UI
tests, which forced the removed inlineStrip variant via a launch-env hook,
now exercise the real chip-then-popover flow instead.

Verified with build-for-testing on the programa scheme (compiles app, unit,
and UI test targets).
…ils always show

Approved removal of the biggest option sprawl in Settings: the 'Hide All
Sidebar Details' master toggle and its 11 dependents (branch layout,
notification message, branch+directory, pull requests, PR/port link
routing, SSH, ports, log, progress, custom metadata). All collapse to
today's defaults: every detail visible, vertical branch layout, sidebar
links open in the Programa browser.

The collapse point is SidebarTabItemSettingsSnapshot.init — TabItemView
(typing-latency protected) only reads that precomputed snapshot, so zero
lines inside it change. SidebarBranchLayoutSettings and
SidebarWorkspaceDetailSettings enums, the settings.json sidebar section
(parse/template/schema), the debug-window branch-layout toggle (would have
become a lying no-op), five dead test blocks, and 30 orphaned localization
keys go with it. Socket-driven features (report_meta pills, git polling,
port scanning) are untouched — only the visibility toggles existed here.

Kept as instructed: sidebar tint/appearance cluster, workspace colors,
search engine picker.
This was referenced Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant